package com.tian.feign;

import com.tian.entity.User;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年05月09日 20:16
 * 博客地址：<a href="http://woaijava.cc/">博客地址</a>
 */
@Component
public class TestFallback implements FallbackFactory<TestFeignClient> {
    private static final Logger LOGGER = LoggerFactory.getLogger(TestFeignClient.class);

    @Override
    public TestFeignClient create(Throwable throwable) {
        LOGGER.error("熔断");
        return id -> new User();
    }
}
